package com.tienon.message.Test;

import java.util.Date;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

import javax.annotation.Resource;

import org.junit.Test;

import com.tienon.message.entity.Push_App;
import com.tienon.message.mapper.Push_AppMapper;
import com.tienon.message.service.LoadSendMsgService;

import com.tienon.message.util.SpringUtil;

public class TestTransaction extends UnitTestEnv{

	@Resource
	private LoadSendMsgService service;
	@Test
	public void testSingleAppMsgTransaction(){
		
		System.out.println(service);		
		Push_App appData = new Push_App();
		appData.setBatId(888);
		appData.setSerial(767);
		appData.setSplitId(1);
		appData.setFilter(1);
		appData.setOccDate(new Date());
		appData.setFee(100);
		appData.setSendNow(1);
		appData.setSendTime(new Date());
		appData.setSplitTotal(111);
		appData.setMsgType(1);
		appData.setMsg("TEST");
		appData.setSplitFlag(1);
		appData.setSendWay(1);
		appData.setBsnCd("123456");
		appData.setSendTimes(1);
		appData.setFeeType(1);
		appData.setOutChannle("1");
		appData.setPrior(1);
		appData.setReportFlag(1);
		appData.setOccDate(new Date());
		appData.setLinkFlag(1);
		appData.setState(1);
		appData.setOccTime(new Date());
		appData.setOutChanCustomId("2");
		Future<Boolean> f = service.loadAppSendMsgTask(appData);
		
		try {
			System.out.println(f.get());
		} catch (InterruptedException e) {
			
			e.printStackTrace();
		} catch (ExecutionException e) {
			
			e.printStackTrace();
		}
	}
	
	
	
	@Test
	public void testGetData(){
		
		Push_App app = new Push_App();
		app.setBatId(123);
		app.setSerial(333);
		app.setSplitId(1);
		app.setFilter(1);
		app.setOccDate(new Date());
		app.setFee(100);
		app.setSendNow(1);
		app.setSendTime(new Date());
		app.setSplitTotal(111);
		app.setMsgType(1);
		app.setMsg("TEST");
		app.setSplitFlag(1);
		app.setSendWay(1);
		app.setBsnCd("123456");
		app.setSendTimes(1);
		app.setFeeType(1);
		app.setOutChannle("1");
		app.setPrior(1);
		app.setReportFlag(1);
		app.setOccDate(new Date());
		app.setLinkFlag(1);
		app.setState(1);
		app.setOccTime(new Date());
		app.setOutChanCustomId("2");
		Push_AppMapper dao = SpringUtil.getDao(Push_AppMapper.class);
		int i = dao.insert(app);
		
		System.out.println(i);
	}
	
}
